package com.demo.design.factory;

import lombok.extern.slf4j.Slf4j;

import javax.swing.*;

/**
 *
 * 简单工厂
 *
 * @author xxg
 */

 public interface Car {
    public  void drive();
}

@Slf4j
  class  Benz implements  Car{
    @Override
    public void drive() {
        log.info("hello ,your Benz  is ready");
    }
}
@Slf4j
class BenBen implements  Car{
    @Override
    public  void drive(){
        log.info("hello,your benben is ready");
    }
}
class Driver {

    public static Car  work(String carName){
        switch (carName){
            case "benben " :
                return new BenBen();
                default:
                    return new Benz();
        }
    }

}
  class Go{
    public static void main(String[] args) {
        final Car car = Driver.work("sss");
        car.drive();
    }
}

